<template>
	<view class="page">
		<view class="mer-info" @click="toUpphone">
			<view class="mer-info-img">
				<image src="/static/img/ic_active.png" v-if="info.activationStatus =='1'" style="width:40px;height:40px;"
					></image>
				<image src="/static/img/ic_unactive.png" v-else style="width:40px;height:40px;"></image>
			</view>
			<view class="mer-info-right">
				<view class="mer-info-right-text">
					<view class="title">
						商户_{{info.merchantName}}
					</view>
					<view class="time">
						入网时间：{{info.accessTime}}
					</view>
				</view>
				<view class="mer-info-right-img">
					<image src="/static/img/index/ic_next_black.png" mode="" style="width:15px;height:15px;"></image>
				</view>
			</view>
		</view>
		<view class="mer-info-box">
			<view class="mer-info-box-left">
				当月总额（元）
			</view>
			<view class="mer-info-box-right orderAmt">
				<text>{{info.orderAmt}}</text>
				<image src="/static/img/index/ic_next_black.png" style="width: 10px; height: 10px; margin-left: 10px;" mode=""></image>
			</view>
		</view>
		<view class="mer-info-box-line">
			
		</view>
		<view class="mer-info-box">
			<view class="mer-info-box-left">
				终端品牌
			</view>
			<view class="mer-info-box-right">
				{{info.newRate}}
			</view>
		</view>
		<view class="mer-info-box">
			<view class="mer-info-box-left">
				终端SN
			</view>
			<view class="mer-info-box-right SN">
				<image src="/static/img/index/ic_copy.png" mode="" style="height: 20px;width: 20px;"></image @click="oncopy(info.sn)">
				<text>{{info.snNo}}</text>
			</view>
		</view>
		<view class="mer-info-box">
			<view class="mer-info-box-left">
				激活状态
			</view>
			<view class="mer-info-box-right active">
				<text v-if="info.activationStatus =='1'">已激活</text>
				<text v-else style="color: #000;">未激活</text>
			</view>
		</view>
		<view class="mer-info-box">
			<view class="mer-info-box-left">
				激活时间
			</view>
			<view class="mer-info-box-right">
				{{info.activationTime}}
			</view>
		</view>
		<view class="mer-info-box-line">
			
		</view>
		<view class="mer-info-box">
			<view class="mer-info-box-left">
				商户编号
			</view>
			<view class="mer-info-box-right">
				{{info.merchantNo}}
			</view>
		</view>
		<view class="mer-info-box">
			<view class="mer-info-box-left">
				商户姓名
			</view>
			<view class="mer-info-box-right">
				{{info.merchantName}}
			</view>
		</view>
		<view class="mer-info-box">
			<view class="mer-info-box-left">
				商户手机号
			</view>
			<view class="mer-info-box-right">
				{{info.phone}}
			</view>
		</view>
		<view class="mer-info-box">
			<view class="mer-info-box-left">
				绑定时间
			</view>
			<view class="mer-info-box-right">
				{{info.bindTime}}
			</view>
		</view>
	</view>
</template>

<script>
	const api = require('../../config/api');
	const util = require('../../utils/util');
	export default {
		data() {
			return {
				sn:'',
				info:{}
			}
		},
		onLoad(o) {
			this.sn = o.sn
			this.getOne();
		},
		onShow() {
		},
		methods: {
			oncopy(e){
				uni.setClipboardData({
					data: e,
					success: function () {
						uni.showToast({
							title:'已复制到剪贴板 ',
							icon:'none'
						});
					}
				});
			},
			toUpphone(){
				uni.navigateTo({
					url:'/pages/myMer/upPhone?phone='+this.info.phone +'&id='+this.info.id
				})
			},
			async getOne() {
				const res = await util.request(
					api.getOneUrl +'/'+this.sn, {},
					'POST'
				);
				// console.log(res);
				if (res.code !== 0) {
					uni.showToast({
						title: res.msg,
						icon: "none"
					})

				} else {
					this.info = res.data
				}
			},
		}
	}
</script>
<style>
	page{
		height: 100%;
		background-color: #F7F7F7;
	}
</style>
<style lang="scss" scoped>
	.page {
	
		height: 100%;
		background-color: #F7F7F7;
	}
	.mer-info{
		margin: 5px;
		border-radius: 5px;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 10px;
		background-color: #fff;
	}
	.mer-info-img{
		
	}
	.mer-info-right{
		margin-left: 10px;
		flex: 1;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}
	.mer-info-right-text{
		.title{
			font-size: 15px;
			color: #000;
			font-weight: 600;
		}
		.time{
			font-size: 14px;
			color: #9C9C9C;
			
		}
	}
	.mer-info-right-img{
		
	}
	.mer-info-box{
		background-color: #fff;
		height: 45px;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 0px 15px;
	}
	.mer-info-box-left{
			font-size: 15px;
			color: #9C9C9C;
	}
	.mer-info-box-right{
		font-size: 15px;
	}
	.orderAmt{
		color: red;
		display: flex;
		align-items: center;
	}
	.mer-info-box-line{
		height: 8px;
		background-color: #F7F7F7;
		width: 100%;
	}
	.SN{
		display: flex;
		align-items: center;
		image{
			margin-right: 15px;
		}
	}
	.active{
		color: #7FACFC;
	}
</style>